package com.service.atf.base.model;

import com.service.atf.base.core.ByteConvertion;
import com.luotao.devp.base.utils.ByteUtil;

/**
 * User: luotao
 * Date: 12-2-23
 * Time: 15:38:00
 * ����֤������	Byte		MP
 * ����֤������	Char(50)		MP
 * �������б���	Char(10)		MP
 * �������п���	Char(30)		MP
 * ���ֱ�ע��Ϣ	Char(50)		MP
 */
public class TFDraw extends BaseFlow implements ByteConvertion {
    private byte custCardType;

    private String custCardId;

    private String custBankCode;

    private String custBankCardId;

    private String drawMemo;

    public TFDraw() {
        setType((byte) '1');
        setTradeType((byte) '3');
    }

    public byte getCustCardType() {
        return custCardType;
    }

    public void setCustCardType(byte custCardType) {
        this.custCardType = custCardType;
    }

    public String getCustCardId() {
        return custCardId;
    }

    public void setCustCardId(String custCardId) {
        this.custCardId = custCardId;
    }

    public String getCustBankCode() {
        return custBankCode;
    }

    public void setCustBankCode(String custBankCode) {
        this.custBankCode = custBankCode;
    }

    public String getCustBankCardId() {
        return custBankCardId;
    }

    public void setCustBankCardId(String custBankCardId) {
        this.custBankCardId = custBankCardId;
    }

    public String getDrawMemo() {
        return drawMemo;
    }

    public void setDrawMemo(String drawMemo) {
        this.drawMemo = drawMemo;
    }

    @Override
    public ByteConvertion byte2Object(byte[] src) {
        byte2ObjectFlow(src);
        setCustCardType((byte) ByteUtil.read(src, LEN_ALL));
        setCustCardId(ByteUtil.readString(src, LEN_ALL + 1, 50));
        setCustBankCode(ByteUtil.readString(src, LEN_ALL + 51, 10));
        setCustBankCardId(ByteUtil.readString(src, LEN_ALL + 61, 30));
        setDrawMemo(ByteUtil.readString(src, LEN_ALL + 91, 50));
        return this;
    }

    @Override
    public byte[] object2Byte() {
        byte[] flow = object2ByteFlow();
        byte[] result = new byte[LEN_ALL + 141];
        System.arraycopy(flow, 0, result, 0, flow.length);
        ByteUtil.write(result, LEN_ALL, getCustCardType());
        ByteUtil.writeString(result, LEN_ALL + 1, getCustCardId(), 50);
        ByteUtil.writeString(result, LEN_ALL + 51, getCustBankCode(), 10);
        ByteUtil.writeString(result, LEN_ALL + 61, getCustBankCardId(), 30);
        ByteUtil.writeString(result, LEN_ALL + 91, getDrawMemo(), 50);
        return result;
    }
}
